﻿/*
* ==============================================================================
*
* Filename: call_user_group_util
* Description: call_user_group_util
*
* Version: 1.0
* Created: 2020/8/25 18:05:03
* Compiler: Visual Studio 2019
*
* Author: Administrator
* Company: freelancer
*
* ==============================================================================
*/

namespace db_util {
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Text;
	using System.Threading.Tasks;
	using db_model;
	using MySql.Data.MySqlClient;

	public class call_user_group_util {
		public static call_user_group_model GetModel(string unique_id) {
			var model = new call_user_group_model();
			string sql = "select id,unique_id,name,create_time,creator,enable from call_user_group where unique_id=?unique_id limit 1";
			MySqlParameter[] parameters = {
	 new MySqlParameter("?unique_id", MySqlDbType.VarChar,36)
				};
			parameters[0].Value = unique_id;
			using (var dr = mysql_helper.GetDataReader(sql, parameters)) {
				if (dr.Read()) {
					model.id = int.Parse(dr["id"].ToString() == "" ? "-1" : dr["id"].ToString());
					model.unique_id = dr["unique_id"].ToString();
					model.name = dr["name"].ToString();
					model.create_time = long.Parse(dr["create_time"].ToString() == "" ? "-1" : dr["create_time"].ToString());
					model.creator = dr["creator"].ToString();
					model.enable = int.Parse(dr["enable"].ToString() == "" ? "-1" : dr["enable"].ToString());
				}
			}
			return model;
		}

	}
}